package exercises;

import java.util.ArrayList;
import java.util.Collection;

public class api03 {
    public static void main(String[] args) {
        /*add 添加
        Collection<String> c= new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        boolean b=//c.add("one");
        System.out.println(b);//true
        System.out.println(c);//[one, two, three, four, five, one]
         */
        /*size 个数
        Collection<String> c= new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c.//size());//5
         */
        /*isEmpty 是否为空
        Collection<String> c= new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c.//isEmpty());//false
         */
        /*clear 清空
        Collection<String> c= new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        c.clear();
        System.out.println(c);//[]
         */
        /*contains 是否包含
        Collection<String> c= new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c.//contains("one"));//true
        System.out.println(c);
         */
        /*remove 删除
        Collection<String> c= new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c.//remove("one"));//true
        System.out.println(c);//[two, three, four, five]
         */
    }
}
